package com.rainxing.cockpit.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Auther: ybzhu
 * @Date: 2018/11/21 10:33
 * @Mail: 110668032@qq.com
 * @Description: 部门转换
 */
public class DepartmentTools {

    /**
     * 市局部门 转 怀柔部门
     *
     * @param list
     * @return
     */
    public static List<Map<String, String>> oldToNewName(List<Map<String, String>> list) {
        for (Map<String, String> m : list) {
            String dname = String.valueOf(m.get("DepartmentName"));
            if (dname.equals("龙山街道执法队")) {
                dname = "龙山";
            }
            if (dname.equals("庙城镇执法队")) {
                dname = "庙城";
            }
            if (dname.equals("泉河街道执法队")) {
                dname = "泉河";
            }
            if (dname.equals("怀柔镇执法队")) {
                dname = "怀柔镇";
            }
            if (dname.equals("怀北镇执法队")) {
                dname = "怀北";
            }
            if (dname.equals("杨宋镇执法队")) {
                dname = "杨宋";
            }
            if (dname.equals("北房镇执法队")) {
                dname = "北房";
            }
            if (dname.equals("宝山镇执法监察队")) {
                dname = "宝山";
            }
            if (dname.equals("雁栖镇执法队")) {
                dname = "雁栖";
            }
            if (dname.equals("桥梓镇执法队")) {
                dname = "桥梓";
            }


            if (dname.equals("渤海镇执法队")) {
                dname = "渤海";
            }
            if (dname.equals("九渡河镇执法队")) {
                dname = "九渡河";
            }
            if (dname.equals("汤河口镇执法队")) {
                dname = "汤河口";
            }
            if (dname.equals("琉璃庙镇执法监察队")) {
                dname = "琉璃庙";
            }
            if (dname.equals("开发区执法监察队")) {
                dname = "开发区";
            }
            if (dname.equals("雁栖示范区执法队")) {
                dname = "示范区";
            }
            if (dname.equals("长哨营满族乡执法监察队")) {
                dname = "长哨营";
            }
            if (dname.equals("喇叭沟门满族乡执法监察队")) {
                dname = "喇叭沟门";
            }
            m.put("DepartmentName", dname);
        }
        return list;
    }

    /**
     * 怀柔部门 转 市局部门
     *
     * @param dname
     * @return
     */
    public static String newTooldName(String dname) {
        if (dname == null) {
            return dname;
        }
        if (dname.equals("龙山街道执法队")) {
            dname = "龙山";
        }
        if (dname.equals("庙城镇执法队")) {
            dname = "庙城";
        }
        if (dname.equals("泉河街道执法队")) {
            dname = "泉河";
        }
        if (dname.equals("怀柔镇执法队")) {
            dname = "怀柔镇";
        }
        if (dname.equals("怀北镇执法队")) {
            dname = "怀北";
        }
        if (dname.equals("杨宋镇执法队")) {
            dname = "杨宋";
        }
        if (dname.equals("北房镇执法队")) {
            dname = "北房";
        }
        if (dname.equals("宝山镇执法监察队")) {
            dname = "宝山";
        }
        if (dname.equals("雁栖镇执法队")) {
            dname = "雁栖";
        }
        if (dname.equals("桥梓镇执法队")) {
            dname = "桥梓";
        }


        if (dname.equals("渤海镇执法队")) {
            dname = "渤海";
        }
        if (dname.equals("九渡河镇执法队")) {
            dname = "九渡河";
        }
        if (dname.equals("汤河口镇执法队")) {
            dname = "汤河口";
        }
        if (dname.equals("琉璃庙镇执法监察队")) {
            dname = "琉璃庙";
        }
        if (dname.equals("开发区执法监察队")) {
            dname = "开发区";
        }
        if (dname.equals("雁栖示范区执法队")) {
            dname = "示范区";
        }
        if (dname.equals("长哨营满族乡执法监察队")) {
            dname = "长哨营";
        }
        if (dname.equals("喇叭沟门满族乡执法监察队")) {
            dname = "喇叭沟门";
        }
        return dname;
    }

    /**
     * 案由新名称
     *
     * @param dname
     * @return
     */
    public static String caseAsName(String dname) {
        if (dname == null) {
            return dname;
        }
        if (dname.equals("市容环境卫生管理")) {
            dname = "市容环境";
        }
        if (dname.equals("建筑施工现场管理")) {
            dname = "施工现场";
        }
        if (dname.equals("工商行政管理")) {
            dname = "工商管理";
        }
        if (dname.equals("1、未经批准进行夜间施工")) {
            dname = "夜施";
        }
        if (dname.equals("城市规划管理")) {
            dname = "违建";
        }
        if (dname.equals("执法风纪")) {
            dname = "执法风纪";
        }
        if (dname.equals("17、建设工程未按规定采取防尘措施")) {
            dname = "扬尘";
        }
        if (dname.equals("5、乱堆物料")) {
            dname = "乱堆物料";
        }
        if (dname.equals("环境保护管理")) {
            dname = "环境保护";
        }
        if (dname.equals("黑车黑导游")) {
            dname = "黑车";
        }


        if (dname.equals("54、运输车辆泄漏遗撒")) {
            dname = "遗撒";
        }
        if (dname.equals("3、店外经营")) {
            dname = "店外";
        }
        if (dname.equals("1、在政府划定的禁止范围内露天烧烤食品")) {
            dname = "露天烧烤";
        }
        if (dname.equals("16、擅自（散发、悬挂、张贴、刻画、涂写、喷涂）宣传品、广告")) {
            dname = "小广告";
        }
        if (dname.equals("停车管理")) {
            dname = "停车管理";
        }
        if (dname.equals("园林绿化管理")) {
            dname = "园林绿化";
        }
        if (dname.equals("2、露天焚烧秸杆、落叶等产生烟尘污染的物质")) {
            dname = "露天焚烧";
        }
        if (dname.equals("市政管理")) {
            dname = "市政管理";
        }
        if (dname.equals("")) {
            dname = "公共事业";
        }
        return dname;
    }

    /**
     * 初始化 list方法
     *
     * @param list
     * @return
     */
    public static List<Map<String, Object>> initDepartName(List<Map<String, Object>> initList, List<Map<String, Object>> list) {
//        List<Map<String, Object>> aList=new ArrayList<>();
        for (int i = 0; i < initList.size(); i++) {
            Map<String, Object> strMap = initList.get(i);
            String strdname = String.valueOf(strMap.get("DepartmentName"));
            Integer strCount = Integer.valueOf(strMap.get("counts").toString());
            for (int j = 0; j < list.size(); j++) {
                Map<String, Object> enpMap = list.get(j);
                String enddname = String.valueOf(enpMap.get("DepartmentName"));
                Integer endCount = Integer.valueOf(enpMap.get("counts").toString());
                if (strdname.equals(enddname)) {
//                    Map<String, Object> map = new HashMap<>();
                    strMap.put("DepartmentName", strdname);
                    strMap.put("counts", endCount);
//                    initList.add(strMap);
                    break;
                }
            }
        }
        return initList;
    }

    /**
     * 初始化 18个执法队
     *
     * @return
     */
    public static Map<String, Integer> returnMap() {
        Map<String, Integer> map = new HashMap<>();
        map.put("龙山街道执法队", 0);
        map.put("庙城镇执法队", 0);
        map.put("泉河街道执法队", 0);
        map.put("怀柔镇执法队", 0);
        map.put("怀北镇执法队", 0);
        map.put("杨宋镇执法队", 0);

        map.put("北房镇执法队", 0);
        map.put("宝山镇执法监察队", 0);
        map.put("雁栖镇执法队", 0);
        map.put("桥梓镇执法队", 0);
        map.put("渤海镇执法队", 0);
        map.put("九渡河镇执法队", 0);

        map.put("汤河口镇执法队", 0);
        map.put("琉璃庙镇执法监察队", 0);
        map.put("开发区执法监察队", 0);
        map.put("雁栖示范区执法队", 0);
        map.put("长哨营满族乡执法监察队", 0);
        map.put("喇叭沟门满族乡执法监察队", 0);
        return map;
    }

}
